function total_c = selectDir(path,num)
    search_path = [path, '\*.jpg'];
    a = dir(search_path);
    s = length(a)
    r = randperm(s);
    r = r(1:num);
    total_c = [];
    for i = 1:num
        p = r(i);
        infile = [path,'\',a(p).name];
        fprintf(2,'%s\n',infile);
        c = selectOneBlock2(infile);
        total_c = [total_c;c];
        clear c;
    end
end
